package com.glsc.ngateway.common.base.domain.mysql.gateway.other;


import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.BeanUtils;

import javax.persistence.*;

/**
 * @Author: libj
 * @Date: 2022/6/27
 * @Desc: 数字证书信息表
 */
@Data
@Entity
@Table(name = "t_am_digital_key")
@org.hibernate.annotations.Table(appliesTo = "t_am_digital_key",comment = "数字证书信息表")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
@EqualsAndHashCode(callSuper=false)
public class DigitalKey extends BaseDigitalKey {
    @ApiModelProperty(value = "数字证书ID")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "key_id", columnDefinition = "int COMMENT '数字证书ID'")
    private Integer keyId;

    //将CustInfo转换为CustInfoLog，并拷贝
    public DigitalKeyLog toDigitalKeyLog() {
        DigitalKey custInfo=this;
        DigitalKeyLog custInfoLog = new DigitalKeyLog();
        BeanUtils.copyProperties(custInfo, custInfoLog);
        return custInfoLog;
    }
}

